var prefixUrl = "http://localhost:8080/userCore/";
var imageUrl = "http://localhost:8080/userCore/images/";

function getNumberList(data) {
    var total = data.data.total;
    var remainder = total%20;
    var allNumber = 0;
    if(remainder > 0){
        allNumber = parseInt(total/20) + 1;
    }else{
        allNumber = parseInt(total/20);
    }
    var number = 1;
    var numberHtml = '<li><a onclick=queryScheduleList('+ "0" +')>«</a></li>';
    for(var i=0; i<allNumber; i++){
        var id = "query-" + i;
        if(i == 0){
            numberHtml = numberHtml
                +'<li id="'+ id + '" name="queryList" class="active"><a onclick=queryScheduleList('+ i +')>' + number + '</a></li>';
        }else{
            numberHtml = numberHtml
                +'<li id="'+ id + '" name="queryList"><a onclick=queryScheduleList('+ i +')>' + number + '</a></li>';
        }
        number++;
    }
    numberHtml = numberHtml + '<li><a onclick=queryScheduleList('+ (allNumber-1) +')>»</a></li>';
    $("#queryList").html(numberHtml);
}

function modalDisplay(){
    $(".modal-backdrop").css("display","none");
    $(".modal").css("display","none");
}


function saveLunBoPic(formData){
    $.ajax({
        type: "POST",
        url: prefixUrl + "image/upload",
        data: formData,
        async: false,
        cache: false,
        contentType: false,
        processData: false,
        success: function (data) {
            lunboImgesUrl =  lunboImgesUrl + imageUrl + data  + "," ;
            console.log(lunboImgesUrl);
        },
        error: function(data) {
            alert("error:"+data.responseText);
        }
    });
}


function goToLogin(data){
    if(data.code == "1001"){
        alert(data.msg);
        window.location.href = "login.html";
    }
}


Date.prototype.Format = function (fmt) { //author: meizz
    var o = {
        "M+": this.getMonth() + 1, //月份
        "d+": this.getDate(), //日
        "H+": this.getHours(), //小时
        "m+": this.getMinutes(), //分
        "s+": this.getSeconds(), //秒
        "q+": Math.floor((this.getMonth() + 3) / 3), //季度
        "S": this.getMilliseconds() //毫秒
    };
    if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
    return fmt;
}
